package com.example.foodDemo.dao;

import com.example.foodDemo.bean.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommentDao extends JpaRepository<Comment,Integer> {
    /*原生的查询语句--》DAO方法对应起来*/
    @Query(value="select id, foodid, userid,comment,postdate from t_comment where foodid = ?1 order by postdate desc", nativeQuery=true )
    List<Comment> findByFoodId(Integer foodid);
}
